Syntax Extension as a Tool for Application Programming
نویسنده
چکیده
Notation is a powerful tool for leveraging our thinking. As an example, most people believe we can conceive of and express algorithms more effectively when we use a suitable computer programming language. It is clear that we lose some capabilities when inappropriately constrained by a language. It possible to accomodate different “paradigms” of thinking by choosing alternative notations or programming languages: this is often the essence of specially designed computer application languages or so-called “methodologies”. The largely unexploited issue we address here is the notion of having one programming language but with a run-time mutable syntax. It seems especially plausible to provide such a feature when the language must address an application whose own notational syntax can mutate, even over a short textual span. This is likely in mathematics and in other fields using formulas in which “customized” new scientific notations are sometimes invented. Preface and Personal Disclaimer I am not keen on extra notational constructs for usual programming. I usually write programs in Lisp, a language notorious for its near-absence of specially distinguished characters and its total lack of precedence rules. All non-atomic Lisp expressions have explicit boundaries marked by parentheses. An expression that appears in a more conventional “infix” syntax as a+b*c+d is written as (+ a (* b c) d), and sin x+cos x is (+ (^ (sin x) 2)(^ (cos x) 2)). To persons raised on infix programming languages such as C, Fortran, Java, this latter form may seem ugly and unfamiliar, but then the conventional expression sin x + cos x is quite unacceptable as input to C, Fortran, Java or Lisp. Observe that this “natural” formula consists of a 2-dimensional variable-font utterance. What is familiar to a mathematician (or even a high school student) is ugly to a computer. It is a conceit of computer scientists that mathematics shares a significant common notation at its core with higher-level To be submitted ISSAC, 2003 “algebraic” programming languages. Admittedly Fortran (whose name comes from Formula Translation) is far closer to formulas than assembly language, yet its notation (and that of various “improvements” on Fortran) merely overlaps a few aspects high-school algebra, constituting a very short step into mathematics. Languages descended from Algol such as Pascal and C are not much better, and perhaps worse in some respects. What is natural? The current Mathematica reference manual displays most of its operators in a table that has about 67 levels of precedence, with some levels containing over a dozen operations. I would be willing to guess at the precedence the expression a∨b∧c, having seen these in logical discussions, but I would not trust my intuition to order the different precedence classes containing the symbols CircleDot, CircleTimes, SmallCircle, Diamond etc. This is an interesting problem: It is certainly plausible that a predefined unified notation for “all the mathematics that you or anyone else can think of” would somehow be useful, and that a sufficiently devoted technician can put it into a computer. But it is also inherently complicated and probably not intuitively clear as a single work. One way we have attempted to conquer this kind of complexity is to simply not mention much of it. Where are we headed? What can we say about the uses of notation in programming languages? Syntax and Manipulating Expressions When it comes time to manipulate expressions, additional criteria for notation must enter into the comparison. Consider the displays below with the question in mind: which you would prefer to manipulate by hand or computer? (each is an abbreviation of (1 + x+ y + z)):
منابع مشابه
Application of Genetic Programming as a Powerful Tool for Modeling of Cellulose Acetate Membrane Preparation
متن کامل
Deficiency of the Space Syntax method as an urban design tool in designing traditional urban space and the need for some supplementary methods
Urban design problems have become so complex that no single designer is able to consider all aspects of a design area simultaneously. Lately the application of computerized and scientific methods have helped designers analyze complex problems. One of these new methods is Space Syntax. The purpose of this study is to first investigate the strengths and weaknesses of this method and then suggest ...
متن کاملMaude Object-Oriented Action Tool
Object-Oriented Action Semantics (OOAS) incorporates object-oriented concepts to the Action Semantics formalism. Its main goal is to obtain more readable and reusable semantics specifications. Moreover, it supports syntax-independent specifications, due to the way classes are written. Maude Object-Oriented Action Tool (MOOAT) is an executable environment for Object-Oriented Action Semantics imp...
متن کاملExtensible languages for flexible and principled domain abstraction
Most programming languages are designed for general-purpose software development in a one-size-fits-all fashion: They provide the same set of language features and constructs for all possible applications programmers ever may want to develop. As with shoes, the one-size-fits-all solution grants a good fit to few applications only. The trend toward domain-specific languages, model-driven develop...
متن کاملTransparent Mobile Middleware Integration for Java and .NET Development Environments
Developing a distributed application for mobile resource constrained devices is a difficult and error-prone task that requires awareness of several system-level details (e.g., fault-tolerance, ...). Several mobile middleware solutions addressing these issues have been proposed. However, they rely on either significant changes in application structure, extensions to the programming language synt...
متن کاملProcess-Oriented Parallel Programming with an Application to Data-Intensive Computing
We introduce process-oriented programming as a natural extension of object-oriented programming for parallel computing. It is based on the observation that every class of an object-oriented language can be instantiated as a process, accessible via a remote pointer. The introduction of process pointers requires no syntax extension, identifies processes with programming objects, and enables proce...
متن کامل